<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>


    let cat= {
        name:'mini',
        age:2,
        color:'yellow',
        desc:'cute'
    }



    console.log(cat)

    console.log(Object.keys(cat)); // ["name", "age", "color", "desc"]

    console.log(Object.values(cat))  // ["mini", 2, "yellow", "cute"]



    let data = {a: 1, b: 2, c: 3, d: 4}

    let array=Object.keys(data).filter(function(x) { return data[x]>2 ;})

    console.log(array)   //数组 ['c','d']



    function Person(){
        this.name='tom'
        this.age=18;
    }
    Person.prototype.height = 180


    let p = new Person()
    for( let key in p){
        if(p.hasOwnProperty(key)){
            console.log("自身属性："+key)// name ,age
        }else{
            console.log("继承构造函数原型对象的属性："+key)// height
        }
    }


   // 合并对象属性  浅拷贝
    let target = { a: 1 };
    let source1 = { b: 2 };
    let source2 = { c: 3 };
    Object.assign(target, source1, source2);
    console.log(target); // {a:1, b:2, c:3}


</script>
</body>
</html>